package com.itheima.dao;

import com.itheima.pojo.User;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/*private Integer id; // 主键
private Date birthday; // 生日
private String gender; // 性别
private String username; // 用户名，唯一
private String password; // 密码
private String remark; // 备注
private String station; // 状态
private String telephone; // 联系电话
private Set<Role> roles = new HashSet<Role>(0);//对应角色集合*/
public interface UserDao {
    @Select("select * from t_user where username = #{username}")
    public User findByUsername(String username);

    @Select("select * from t_user where username = #{username}")
    @Results({
            @Result(property = "id",column = "id"),
            @Result(property = "username",column = "usernam"),
            @Result(property = "password",column = "password"),
            @Result(
                    column = "id",
                    property = "roles",//javabean类中的属性
                    javaType = List.class,//该属性的类型
                    many = @Many(select = "com.itheima.dao.CheckGroupDao.findByUserId1")
            )
    })
    public User findByUsername1(String username);
}
